package com.demo.association.onetoone;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

@Entity
@Table(name="BIOGRAPHY")
public class Biography {

	private int id;
	private String biographyDetails;
	private Auther auther;
	
	@OneToOne(mappedBy="biography")
	public Auther getAuther() {
		return auther;
	
	}

	@Id
	@GenericGenerator(name="myCustomGenerator",strategy="foreign",parameters=@Parameter(name="property",value="auther"))
	@GeneratedValue(generator="myCustomGenerator")
	@Column(name="BIOGRAPHY_ID")
	public int getId() {
		return id;
	}

	
	@Column(name="BIOGRAPHY_DETAIL")
	public String getBiographyDetails() {
		return biographyDetails;
	}

	public void setAuther(Auther auther) {
		this.auther = auther;
	}
	
	public void setId(int id) {
		this.id = id;
	}

	public void setBiographyDetails(String biographyDetails) {
		this.biographyDetails = biographyDetails;
	}

	/*
	 * @PrePersist public void setDefaultValues(){
	 * 
	 * 
	 * 
	 * }
	 * 
	 * @PreUpdate public void updateDefault(){
	 * 
	 * 
	 * }
	 */

}
